/*
* configdlg.h - This file is the part of the wp-notifier.(code name "luan luan")
* Copyright (C) 2010 Dean Lee <deanlee3@gmail.com>, http://www.deanlee.cn
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
* 
* Acknowledgements:
*   <> Many thanks to all of you, who have encouraged me to update my articles
*     and code, and who sent in bug reports and fixes.
* 
*/
#ifndef CONFIGDLG_H
#define CONFIGDLG_H
#include <QDomDocument>
#include <QDomElement>
#include <QDateTime>
#include <QList>
#include <QSharedData>
#include "ui_configdlg.h"
class Comment;
class Blog;

class BlogComments
{
public:
	BlogComments(){}
	~BlogComments();
	
};
//class BlogAccounts : public QObject
//{
//	Q_OBJECT
//public:
//	BlogAccounts(QObject* parent = NULL);
//	~BlogAccounts();
//	void deleteAccount(const Blog* blog);
//	void addAccount(const Blog* blog);
//	void updateAccount(const Blog* blog);
//signals:
//	void accountCountChanged(int);
//	//void accountUpdated(int);
//	//void accountEdit(int);
//};
class Option
{
public:
	Option();
	void Init();
	void fromXml(const QDomElement& el);
	QDomElement toXml(QDomDocument *doc)const;
	//bool save();
	//bool load();
	bool m_showFullComments;
	int m_pageSize;
	int m_checkInterval;
	QSize m_winSize;
	bool m_autoStart;
	//QList<Blog*> m_blogs;
};
extern Option s_opt;

class ConfigDlg : public QDialog
{
	Q_OBJECT
public:
	~ConfigDlg();
	void done ( int r );
	static ConfigDlg* showConfigDlg();
signals:
	void accountUpdated(Blog* blog);
	void accountAdded(Blog* blog);
	void accountDeleted(Blog* blog);
	protected slots:
		void rowsChanged();
		void currentRowChanged(int currentRow);
		void editAccount();
		void addAccount();
		void deleteAccount();
		void viewAccount();
		void clicked(QAbstractButton *);
private:
	void manageAccount(const Blog* blog);
	ConfigDlg(QWidget* parent = NULL);
protected:
	Ui::ConfigDlg ui_;
	static ConfigDlg* s_instance;
};

#endif